package org.lanqiao.tjut.entity;

import java.util.List;

import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.junit.Test;
import org.lanqiao.tjut.driver.GetdriverFactory;

public class TestDriver {

	public void doQuery() {

		// 输入查询语句
		String str = "select * from student ";
		// 获取查询结果
		List list = (List) GetdriverFactory.DriverFactory().query(str, new BeanListHandler(StudentEntity.class));
		System.out.println(list.toString());

	}

	@Test
	public void doinsert1() {
		// 输入插入语句
		String str = "insert into Student(Studentid,Studentage,Studentaddress,Studentname,Studentsex,Studentpassword,Studenttel)  values('16','20','上海','李','女','424545','45454545') ";
		int i = GetdriverFactory.DriverFactory().insert(str);
		System.out.println(i > 0 ? "插入成功" : "插入失败");
	}

@Test
    public void doinsert(){
	        //输入插入语句
String str="insert into Student        (Studentid,Studentage,Studentaddress,Studentname,Studentsex,Studentpassword,Studenttel)    values(?,?,?,?,?,?,?)";
	        int i=GetdriverFactory.DriverFactory().insert1(str,new Object[]{19,20,"武汉","小明","男","454578",45478});
	        System.out.println(i>0? "插入成功":"插入失败");
}

}
